1 using UnityEngine;
2 using
System.Collections;
3 using
UnityEngine.SceneManagement;
4 namespace
MapScreen
5 {
6     
public class BackButton : InputAdapter
7     {
8         
public override void OnTouchDown()
9         {
10             
base.OnTouchDown();
11             transform.localScale =
new Vector3(0.9f, 0.9f, transform.localScale.z);
12             SoundManager.playButtonSound();
13         }
14
15         
public override void OnCheckUp()
16         {
17             
base.OnCheckUp();
18             transform.localScale =
new Vector3(1, 1, transform.localScale.z);
19         }
20
21         
public override void OnTouchUp()
22         {
23             
base.OnTouchUp();
24             SceneManager.LoadScene(
"MainMenu");
25         }
26
27         
public void Update()
28         {
29             
if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Backspace))
30             {
31                 SceneManager.LoadScene(
"MainMenu");
32             }
33         }
34     }
35
36 }



Trò chơi đua xe động vật trong UNITY Engine 114.931 lượt xem

Gõ tìm kiếm nhanh...